﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace t01crm.Data
{
    public partial class HG_Prod_Catalog : INotifyPropertyChanged
    {

        #region Data

        private  List<HG_Prod_Catalog> _children;
        //private HG_Prod_Catalog _parent;
        

        //bool _isExpanded;
        //bool _isSelected;

        #endregion // Data
        #region Constructors

       
   

        #endregion // Constructors

        public List<HG_Prod_Catalog> Children
        {
            get {
                //_children = new List<HG_Prod_Catalog>();
                      
                //using (tb01crmEntities ctx = new tb01crmEntities())
                //{


                //    _children = (from c in ctx.HG_Prod_Catalog 
                //                            where c.catalog_father==this.catalog_id   
                                            
                //                            select c).ToList();
                  
                //}

                if (_children == null) _children = new List<HG_Prod_Catalog>();
                return _children;
            }
        }

        #region IsExpanded

        /// <summary>
        /// Gets/sets whether the TreeViewItem 
        /// associated with this object is expanded.
        /// </summary>
        //public bool IsExpanded
        //{
        //    get { return _isExpanded; }
        //    set
        //    {
        //        if (value != _isExpanded)
        //        {
        //            _isExpanded = value;
        //            this.OnPropertyChanged("IsExpanded");
        //        }

        //        // Expand all the way up to the root.
        //        if (_isExpanded && _parent != null)
        //            _parent.IsExpanded = true;
        //    }
        //}

        #endregion // IsExpanded

        #region IsSelected

        /// <summary>
        /// Gets/sets whether the TreeViewItem 
        /// associated with this object is selected.
        /// </summary>
        //public bool IsSelected
        //{
        //    get { return _isSelected; }
        //    set
        //    {
        //        if (value != _isSelected)
        //        {
        //            _isSelected = value;
        //            this.OnPropertyChanged("IsSelected");
        //        }
        //    }
        //}

        #endregion // IsSelected

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        protected virtual void OnPropertyChanged(string propertyName)
        {
            if (this.PropertyChanged != null)
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
        }

        #endregion // INotifyPropertyChanged Members
    }
}
